/*
 *  $Id: IllusionHandL.cs 939 2009-12-03 13:12:41Z thenn.erannor $
 *  This file is a part of Ragima CCG.
 *  (C) 2008 Ragima development group.
 *
 *  Licensed under the terms of the GNU GPL License version 2.
 *
 */

using System.Collections.Generic;

namespace Ragima.Cards001.Water.Abilities {
    public class IllusionHandL: AbilityCard {
        public IllusionHandL(): base("001_w_a_illusion_hand_l") {
            Level = CompleteLevel.ReadyForTest;
            Element = ElementType.Air;
            AddCondition(new DelegateCondition(GetConditionPhrase(), Creatures.IllusionLord.HasCreaturesWithHandOfIllusion));
        }

        public override void DoAction(TargetArgs args) {
            List<Creature> list = Creatures.IllusionLord.GetCreaturesWithHandOfIllusion(args.Player);
            if (list.Count == 0) return;
            foreach (Creature cr in list) cr.AddAffect(new IllusionHandLAffect(list.Count+1));
        }

        private class IllusionHandLAffect: SpellAffect<IllusionHandL> {
            private int _value;

            public IllusionHandLAffect(int value): base(true) {
                DefaultDescription = true;
                _value = value;
                Add(new Affects.Paralysis(value));
            }

            public override Affect Clone() {
                return new IllusionHandLAffect(_value);
            }

            public override string DescriptionText {
                get { return Description.GetText(_value); }
            }
        }
    }
}
